﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Roller.ViewModels;

namespace DiceRollingTests.RollerApplication
{
    [TestClass()]
    public class RollingViewModelTests
    {
        [TestMethod()]
        public void DiceShouldNotBeNull()
        {
            var mock = new Mock<RollingViewModel>();
            var viewModel = mock.Object;

            Assert.IsNotNull( viewModel.Dice );
        }

        [TestMethod()]
        public void AddDiceMethodShouldAddObjectToDice()
        {
            var mock = new Mock<RollingViewModel>();
            var viewModel = mock.Object;

            viewModel.AddDice( "6" );

            Assert.AreEqual( 1, viewModel.Dice.Count );
        }

        [TestMethod()]
        public void ShouldRollAllDiceInCollection()
        {
            var mock = new Mock<RollingViewModel>();
            var viewModel = mock.Object;

            viewModel.AddDice( "4" );
            viewModel.AddDice( "6" );

            var rollOneValue = viewModel.Dice.First().LastRoll;
            var rollTwoValue = viewModel.Dice.Last().LastRoll;

            viewModel.RollDice( null );

            Assert.AreNotEqual( rollOneValue, viewModel.Dice.First().LastRoll );
            Assert.AreNotEqual( rollTwoValue, viewModel.Dice.Last().LastRoll );
        }
    }
}
